//
//  ingredientsViewController.m
//  ForengnMenu
//
//  Created by wenzhaoxu on 16/1/19.
//  Copyright © 2016年 余旺. All rights reserved.
//

#import "ingredientsViewController.h"

@interface ingredientsViewController ()<UICollectionViewDataSource,UICollectionViewDelegate>

@property (weak, nonatomic) IBOutlet UICollectionView *myCollectionView;


@end

@implementation ingredientsViewController

- (void)viewDidLoad {
    [super viewDidLoad];

    
    UIButton * leftBnt = [UIButton buttonWithType:UIButtonTypeCustom];
    [leftBnt setTitle:@"取消" forState:UIControlStateNormal];
    [leftBnt setTitleColor:[UIColor colorWithRed:248/255.0f green:102/255.0f blue:79/255.0f alpha:1.0f] forState:UIControlStateNormal];
    
    leftBnt.titleLabel.font = [UIFont systemFontOfSize:16];
    
    leftBnt.frame = CGRectMake(0, 0, 35, 30);
    
    [leftBnt addTarget:self action:@selector(editAction) forControlEvents:UIControlEventTouchUpInside];
    
    self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithCustomView:leftBnt];
    
    UIButton * rightBnt = [UIButton buttonWithType:UIButtonTypeCustom];
    [rightBnt setTitle:@"保存" forState:UIControlStateNormal];
    [rightBnt setTitleColor:[UIColor colorWithRed:248/255.0f green:102/255.0f blue:79/255.0f alpha:1.0f] forState:UIControlStateNormal];
    
    rightBnt.titleLabel.font = [UIFont systemFontOfSize:16];
    
    rightBnt.frame = CGRectMake(0, 0, 35, 30);
    
    [rightBnt addTarget:self action:@selector(saveAction) forControlEvents:UIControlEventTouchUpInside];
    
    self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithCustomView:rightBnt];
    
    self.view.backgroundColor = [UIColor colorWithRed:246/255.0f green:247/255.0f blue:239/255.0f alpha:1.0f];
    
    self.myCollectionView.backgroundColor = [UIColor clearColor];
    
}
-(void)editAction{
    
    //返回到前一级界面.注意： 必须是通过navigationController的push方式跳入进去的
    [self.navigationController popViewControllerAnimated:YES];
    
}

-(void)saveAction{
    
    
    [self.navigationController popViewControllerAnimated:YES];
}
- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section{
    return 2;
}
- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath{

    static NSString * identifier = @"Cell1";
    
    UICollectionViewCell * cell = [collectionView dequeueReusableCellWithReuseIdentifier:identifier forIndexPath:indexPath];
    
    return cell;
}


@end
